package com.tanhua.model.vo;

import com.tanhua.model.domain.Announcements;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.text.SimpleDateFormat;

/**
 * @program: tanhua
 * @description: 公告
 * @author: leiyukun
 * @create: 2022-03-31 16:34
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AnnouncementsVo implements Serializable {
    private String id;
    private String title;
    private String description;
    private String createDate;

    public static AnnouncementsVo init(Announcements announcements){
        AnnouncementsVo vo=new AnnouncementsVo();
        BeanUtils.copyProperties(announcements,vo);
        vo.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(announcements.getCreated()));
        return vo;
    }
}
